﻿using System;
using System.Data.Entity;
using System.Data.Entity.Infrastructure;
using ProjetoComperio.DataLayer.Entities;
using Environment = ProjetoComperio.DataLayer.Entities.Environment;
//using DataLayer;

namespace ProjetoComperio.DataLayer.Infra
{
    public class ComperioDataModel : DbContext, IComperioEntitiesDataModel
    {
        public ComperioDataModel(DbModel model)
            : base(model)
        {
        }
        public void SaveChanges()
        {
            base.SaveChanges();
        }

        public void DeleteDatabase()
        {
            this.Database.Delete();
        }

        public void CreateDatabase()
        {
            this.Database.Create();
        }

        public bool DatabaseExists()
        {
            return this.Database.Exists();
        }

        public IDbSet<AcademicOrganization> AcademicOrganizations { get; set; }


        public IDbSet<AcademicOrganizationType> AcademicOrganizationTypes { get; set; }

        public IDbSet<AgeRange> AgeRanges { get; set; }

        public IDbSet<Course> Courses { get; set; }

        public IDbSet<Comment> Comments { get; set; }

        public IDbSet<Subject> Subjects { get; set; }

        public IDbSet<EducationLevel> EducationLevels { get; set; }

        public IDbSet<Context> Contexts { get; set; }

        public IDbSet<Contribution> Contributions { get; set; }

        public IDbSet<ContributionItem> ContributionItems { get; set; } 

        public IDbSet<Environment> Environments { get; set; }

        public IDbSet<KnowledgeArea> KnowledgeAreas { get; set; }

        public IDbSet<NewContributionMember> NewContributionMembers { get; set; }

        public IDbSet<Person> People { get; set; }

        public IDbSet<Platform> Platforms { get; set; }

        public IDbSet<Proposal> Proposals { get; set; }

        public IDbSet<AcademicPersonCV> AcademicPersonCVs { get; set; }
                
        public IDbSet<Application> Applications { get; set; }

        public IComperioEntitiesDataModel Initialize()
        {
            return this;
        }

        public Boolean IsInitialized { get; set; }

        /// <summary>
        /// This constructor should not be used, It is in use just because we need
        /// to use Initialize method
        /// </summary>
        public ComperioDataModel()
            : base("Name=ComperioEntities")
        {
            //This constructor should not be used, It is in use just because we need
            //to use Initialize method
        }

    }
}
